#!/bin/bash

. init_metadata.sh
. parallel_hive_exec.sh

#mysql
V_MYSQL_HOST=192.168.100.193
V_MYSQL_USER=hadoop
V_MYSQL_PSWD=hadoop
#base_path
BASE_PATH=/home/hadoop/hive_load
#load_path
LOAD_PATH=/home/hadoop/hive_load/load_file
#账期
D_DATE="201801"

#初始化文件元数据
function init_metadata(){
	echo "init_metadata begin ..."
	init_table
	traversal $LOAD_PATH
	echo "init_metadata end ..."
}

#并行处理hive任务
function parallel_hive_exec(){
	echo "parallel_hive_exec begin ..."
	parallel_process_file
	echo "parallel_hive_exec end ..."
}

function_name=$1
if [[ x$function_name == xinit_metadata ]];then
	init_metadata
elif [[ x$function_name == xprocess_one_file_core ]];then
	process_one_file_core $2 $3 $4
elif [[ x$function_name == xparallel_hive_exec ]];then
	parallel_hive_exec
else
	echo "[-] Can not found this function. It is only one of init_metadata|parallel_hive_exec."
fi
